#ifndef FONT_H
#define FONT_H

#include <gccore.h>

class Font
{
public:
	// size is the nominal size of the font rendered in the texture. Actual draw size can be adjusted by GX during rendering.
	Font(const void* fontBuffer, unsigned long fontBufferSize, unsigned int size);
	~Font();
	int drawText( int x, int y, const char* str, int height);
	// height is used as measure of character size
	int getTextWidth(const char* str, int height) {int retVal = 0; while(*str!='\0') retVal+=charWidth[*str++]; return retVal*height/charHeight;};
	
private:
	float drawChar( int x1, int y1, char character, int height);

	int charWidth[256];
	int charHeight;

	u8* texture;
// debug
	int max_advance_width;
	GXTexObj texObj;
};

void FontInit();
void FontDone();

extern Font* defaultFont;

#endif
